<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html,charset=UTF-8">
    <title>个人中心</title>
    <head th:insert="import :: head"></head>
<!--    <link rel="stylesheet" href="/css/bootstrap.min.css">-->
<!--    <link rel="stylesheet" href="/css/bootstrap-theme.min.css">-->
<!--    <link rel="stylesheet" href="/css/community.css">-->
<!--    <script src="/js/jquery-3.6.4.min.js"></script>-->
<!--    <script src="/js/bootstrap.min.js"></script>-->
</head>
<body>
<div th:insert="navigation :: nav"></div>
<div class="container-fluid main">
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
            <!--页面名字-->
            <h3 th:text="${sectionName}"></h3>

            <hr class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            <!--我的问题-->
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" th:if="${section == 'questions'}">
                <div class="media" th:each="question : ${pagination.list}">
                    <div class="media-left">
                        <a href="#">
                            <img class="media-object img-rounded"
                                 th:src="${question.user.avatarUrl}" alt="...">
                        </a>
                    </div>
                    <div class="media-body">
                        <!--                        <h4 class="media-heading" th:text="${question.title}">如何成功是社会倒退一百年</h4>-->
                        <h4><a th:href="${'/question/'+ question.id}" th:text="${question.title}"></a></h4>
                        <span th:text="${question.description}">其实我也不知道，在线找想法</span>
                        <span class="text-desc pull-right">
                            <a th:href="@{'/publish/'+${question.id}}" class="community-menu"
                                                   th:if="${session.user!=null&&session.user.id==question.creator}">
                                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                                编辑
                            </a>
                        <span th:text="${question.commentCount==null?0:question.commentCount}"></span> 个评论 •
                        <span th:text="${question.viewCount==null?0:question.viewCount}"></span>次浏览 •
                        <span th:text="${#dates.format(question.gmtModified,'yyyy-MM-dd HH:mm')}"></span>
                        </span>
                    </div>
                </div>
            </div>
            <!--最新回复-->
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" th:if="${section == 'notifies'}">
                <div class="media" th:each="notification : ${pagination.list}">
                    <div class="media-body">
                        <p class="media-heading">
                            <span th:text="${notification.notifierName + ' 于 '}"></span>
                            <span th:text="${#dates.format(notification.gmtCreate,'yyyy-MM-dd HH:mm')}"></span>
                            <span th:text="${notification.typeName+' '}"></span>
                            <span th:if="${notification.type==1}"
                                  th:text="${notification.commentTitle+' 该评论是评论问题:'}"></span>
                            <a th:href="@{'/notification/'+ ${notification.id}}"
                               th:text="${notification.questionTitle}"></a>
                            <span class="label label-success" th:if="${notification.status == 1}">已读</span>
                            <span class="label label-danger" th:if="${notification.status==0}">未读</span>
                        </p>

                    </div>
                </div>
            </div>
            <!--我的收藏-->
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" th:if="${section == 'likes'}">
                <div class="media" th:each="question : ${pagination.list}">
                    <div class="media-left">
                        <a href="#">
                            <img class="media-object img-rounded"
                                 th:src="${question.user.avatarUrl}" alt="...">
                        </a>
                    </div>
                    <div class="media-body">
                        <h4><a th:href="${'/question/'+ question.id}" th:text="${question.title}"></a></h4>
                        <span th:text="${question.description}"></span>
                        <span class="text-desc pull-right">
                            <span th:text="${question.commentCount==null?0:question.commentCount}"></span> 个评论 •
                            <span th:text="${question.viewCount==null?0:question.viewCount}"></span>次浏览 •
                            <span th:text="${#dates.format(question.gmtModified,'yyyy-MM-dd HH:mm')}"></span>
                        </span>
                    </div>
                </div>
            </div>
            <!--页码-->
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <li th:if="${!pagination.isFirstPage}">
                        <a th:href="@{'/profile/'+${section}(page=${1})}" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <li th:if="${pagination.hasPreviousPage}">
                        <a th:href="@{'/profile/'+${section}(page=${pagination.pageNum - 1})}" aria-label="Previous">
                            <span aria-hidden="true">&lt;</span>
                        </a>
                    </li>
                    <li th:each="page : ${pagination.navigatepageNums}"
                        th:class="${pagination.pageNum == page}?'active':''">
                        <a th:href="@{'/profile/'+${section}(page=${page})}" th:text="${page}"></a>
                    </li>
                    <li th:if="${pagination.hasNextPage}">
                        <a th:href="@{'/profile/'+${section}(page=${pagination.pageNum + 1})}" aria-label="Next">
                            <span aria-hidden="true">&gt;</span>
                        </a>
                    </li>
                    <li th:if="${!pagination. isLastPage}">
                        <a th:href="@{'/profile/'+${section}(page=${pagination.pages})}" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>

        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <div class="list-group">
                <a href="/profile/questions"
                   th:class="${section == 'questions'}?'list-group-item active':'list-group-item'">
                    我的提问
                    <span class="badge" th:text="${pagination.total}" th:if="${section == 'questions'}"></span>
                </a>
                <a href="/profile/notifies"
                   th:class="${section == 'notifies'}?'list-group-item active':'list-group-item'">
                    最新回复
                    <span class="badge" th:text="${session.unreadCount}" th:if="${session.unreadCount!=0}"></span>
                </a>
                <a href="/profile/likes"
                   th:class="${section == 'likes'}?'list-group-item active':'list-group-item'">
                    我的收藏
                    <span class="badge" th:text="${pagination.total}" th:if="${section == 'likes'}"></span>
                </a>
            </div>
        </div>
    </div>

</div>
<div th:insert="footer :: foot"></div>
</body>
</html>